home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / lib / openoffice / program / soffice < prev    next >
Encoding:
Text File  |  2012-10-08  |  6.4 KB  |  253 lines

  1. #!/bin/sh
  2. #*************************************************************************
  3. #
  4. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5. #
  6. # Copyright 2000, 2010 Oracle and/or its affiliates.
  7. #
  8. # OpenOffice.org - a multi-platform office productivity suite
  9. #
  10. # This file is part of OpenOffice.org.
  11. #
  12. # OpenOffice.org is free software: you can redistribute it and/or modify
  13. # it under the terms of the GNU Lesser General Public License version 3
  14. # only, as published by the Free Software Foundation.
  15. #
  16. # OpenOffice.org is distributed in the hope that it will be useful,
  17. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. # GNU Lesser General Public License version 3 for more details
  20. # (a copy is included in the LICENSE file that accompanied this code).
  21. #
  22. # You should have received a copy of the GNU Lesser General Public License
  23. # version 3 along with OpenOffice.org.  If not, see
  24. # <http://www.openoffice.org/license.html>
  25. # for a copy of the LGPLv3 License.
  26. #
  27. #*************************************************************************
  28.  
  29. if test -z "$HOME"; then
  30.     HOME=$(getent passwd $(whoami) | cut -d":" -f6)
  31. fi
  32.  
  33. # helper functions
  34. home_on_nfs()
  35. {
  36.     case $(stat -f -c %T $HOME) in cifs|nfs|smb)
  37.         return 0
  38.     esac
  39.     return 1
  40. }
  41. file_on_nfs(){
  42.     for i; do
  43.        case "$i" in -*) continue; esac
  44.        [ -f "$i" ] || continue
  45.        case $(stat -f -c %T "$i") in cifs|nfs|smb)
  46.             return 0
  47.        esac
  48.     done
  49.     return 1
  50. }
  51.  
  52. # FIXME: this is conservative; allow more known working configurations
  53. working_opengl_support()
  54. {
  55.     if [ -n "$(lsmod | awk '/^(fglrx|nvidia)/ {print $1}')" ]; then
  56.        return 1
  57.     fi
  58.     return 0
  59. }
  60.  
  61. # read config file
  62.  
  63. FILE_LOCKING=auto
  64. OPENGL_SUPPORT=no
  65. if [ -f /etc/openoffice/soffice.sh ]; then
  66.     . /etc/openoffice/soffice.sh
  67. fi
  68.  
  69. # sanity checks
  70.  
  71. case "$FILE_LOCKING" in
  72.     auto|yes|no) ;;
  73.     *)
  74.         echo >&2 "unknown value '$FILE_LOCKING' for FILE_LOCKING parameter."
  75.        FILE_LOCKING=auto
  76.        echo >&2 "FILE_LOCKING reset to '$FILE_LOCKING'"
  77. esac
  78.  
  79. case "$OPENGL_SUPPORT" in
  80.     auto|yes|no) ;;
  81.     *)
  82.         echo >&2 "unknown value '$OPENGL_SUPPORT' for OPENGL_SUPPORT parameter."
  83.        OPENGL_SUPPORT=auto
  84.        echo >&2 "OPENGL_SUPPORT reset to '$OPENGL_SUPPORT'"
  85. esac
  86.  
  87. # adjust environment
  88.  
  89. if [ -z "$SAL_ENABLE_FILE_LOCKING" ]; then
  90.     case "$FILE_LOCKING" in
  91.        auto)
  92.         home_on_nfs "$@"
  93.         if [ $? = 0 ]; then
  94.            STAR_PROFILE_LOCKING_DISABLED=1
  95.            export STAR_PROFILE_LOCKING_DISABLED
  96.        fi
  97.        file_on_nfs "$@"
  98.        if [ $? = 0 ]; then
  99.            SAL_ENABLE_FILE_LOCKING=0
  100.            export SAL_ENABLE_FILE_LOCKING
  101.            # for safety
  102.            STAR_ENABLE_FILE_LOCKING=0
  103.            export STAR_ENABLE_FILE_LOCKING
  104.        else
  105.             # file locking now enabled by default
  106.            SAL_ENABLE_FILE_LOCKING=1
  107.            export SAL_ENABLE_FILE_LOCKING
  108.        fi
  109.         ;;
  110.        yes)
  111.        SAL_ENABLE_FILE_LOCKING=1
  112.        export SAL_ENABLE_FILE_LOCKING
  113.         ;;
  114.        no)
  115.        SAL_ENABLE_FILE_LOCKING=0
  116.        export SAL_ENABLE_FILE_LOCKING
  117.        # for safety
  118.        STAR_ENABLE_FILE_LOCKING=0
  119.        export STAR_ENABLE_FILE_LOCKING
  120.        STAR_PROFILE_LOCKING_DISABLED=1
  121.        export STAR_PROFILE_LOCKING_DISABLED
  122.     esac
  123. fi
  124.  
  125. if [ -z "$SAL_NOOPENGL" ]; then
  126.     case "$OPENGL_SUPPORT" in
  127.        auto)
  128.         working_opengl_support
  129.         if [ $? -eq 0 ]; then
  130.            SAL_NOOPENGL=true
  131.            export SAL_NOOPENGL
  132.        fi
  133.         ;;
  134.        yes)
  135.        :
  136.        unset SAL_NOOPENGL
  137.        #export SAL_NOOPENGL
  138.         ;;
  139.        no)
  140.        SAL_NOOPENGL=true
  141.        export SAL_NOOPENGL
  142.     esac
  143. fi
  144.  
  145. # the following test is needed on Linux PPC with IBM j2sdk142
  146. # These variables are substituted during the build process
  147. if [ "LINUX" = "LINUX" -a "X86_64" = "POWERPC" ] ; then
  148.     JITC_PROCESSOR_TYPE=6
  149.     export JITC_PROCESSOR_TYPE
  150. fi
  151.  
  152. # resolve installation directory
  153. sd_cwd="`pwd`"
  154. if [ -h "$0" ] ; then
  155.     sd_basename=`basename "$0"`
  156.      sd_script=`ls -l "$0" | sed "s/.*${sd_basename} -> //g"`
  157.     cd "`dirname "$0"`"
  158.     cd "`dirname "$sd_script"`"
  159. else
  160.     cd "`dirname "$0"`"
  161. fi
  162. sd_prog=`pwd`
  163. cd "$sd_cwd"
  164.  
  165. sd_binary=`basename "$0"`.bin
  166.  
  167. #collect all bootstrap variables specified on the command line
  168. #so that they can be passed as arguments to javaldx later on
  169. for arg in $@
  170. do
  171.   case "$arg" in
  172.        -env:*) BOOTSTRAPVARS=$BOOTSTRAPVARS" ""$arg";;
  173.   esac
  174. done
  175.  
  176. # pagein
  177. sd_pagein_args=@pagein-common
  178. for sd_arg in "$@"; do
  179.     case ${sd_arg} in
  180.     -calc)
  181.         sd_pagein_args="${sd_pagein_args} @pagein-calc"
  182.         break;
  183.         ;;
  184.     -draw)
  185.         sd_pagein_args="${sd_pagein_args} @pagein-draw"
  186.         break;
  187.         ;;
  188.     -impress)
  189.         sd_pagein_args="${sd_pagein_args} @pagein-impress"
  190.         break;
  191.         ;;
  192.     -writer)
  193.         sd_pagein_args="${sd_pagein_args} @pagein-writer"
  194.         break;
  195.         ;;
  196.     esac
  197. done
  198. "$sd_prog/../basis-link/program/pagein" -L"$sd_prog/../basis-link/program" \
  199.     ${sd_pagein_args}
  200.  
  201. # extend the ld_library_path for java: javaldx checks the sofficerc for us
  202. if [ -x "$sd_prog/../basis-link/ure-link/bin/javaldx" ] ; then
  203.     my_path=`"$sd_prog/../basis-link/ure-link/bin/javaldx" $BOOTSTRAPVARS \
  204.         "-env:INIFILENAME=vnd.sun.star.pathname:$sd_prog/redirectrc"`
  205.     if [ -n "$my_path" ] ; then
  206.         LD_LIBRARY_PATH=$my_path${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
  207.         export LD_LIBRARY_PATH
  208.     fi
  209. fi
  210.  
  211. unset XENVIRONMENT
  212.  
  213. # uncomment line below to disable anti aliasing of fonts
  214. # SAL_ANTIALIAS_DISABLE=true; export SAL_ANTIALIAS_DISABLE
  215.  
  216. # uncomment line below if you encounter problems starting soffice on your system
  217. # SAL_NO_XINITTHREADS=true; export SAL_NO_XINITTHREADS
  218.  
  219. # read database entries for Adabas D
  220. if [ -f /etc/adabasrc ]; then
  221.   . /etc/adabasrc
  222. fi
  223.  
  224. # Set PATH so that crash_report is found:
  225. PATH=$sd_prog${PATH+:$PATH}
  226. export PATH
  227.  
  228. PYTHONPATH=$sd_prog/../basis-link/program${PYTHONPATH+:$PYTHONPATH}
  229. export PYTHONPATH
  230.  
  231. # test for availability of the fast external splash
  232. for arg in $@; do
  233.     if [ "$arg" = "-nologo" -o "$arg" = "-no-oosplash" ]; then
  234.         no_oosplash=y
  235.     fi
  236. done
  237. if [ "$sd_binary" = "soffice.bin" -a -x "$sd_prog/oosplash.bin" ] && [ "$no_oosplash" != "y" ] ; then
  238.     sd_binary="oosplash.bin"
  239. fi
  240.  
  241. # execute soffice binary
  242. "$sd_prog/$sd_binary" "$@" &
  243. trap 'kill -9 $!' TERM
  244. wait $!
  245.  
  246. while [ $? -eq 79 ]
  247. do
  248.     "$sd_prog/$sd_binary" ""$BOOTSTRAPVARS"" &
  249.     wait $!
  250. done
  251.  
  252. exit
  253.